home *** CD-ROM | disk | FTP | other *** search
- head 1.11;
- access;
- symbols
- stage1:1.8;
- locks; strict;
- comment @ * @;
-
-
- 1.11
- date 94.04.30.00.07.10; author peteric; state Exp;
- branches;
- next 1.10;
-
- 1.10
- date 94.04.27.11.37.54; author peteric; state Exp;
- branches;
- next 1.9;
-
- 1.9
- date 94.03.26.11.28.03; author peteric; state Exp;
- branches;
- next 1.8;
-
- 1.8
- date 94.03.10.21.28.26; author peteric; state Exp;
- branches;
- next 1.7;
-
- 1.7
- date 94.03.07.12.46.37; author peteric; state Exp;
- branches;
- next 1.6;
-
- 1.6
- date 94.03.01.23.17.53; author peteric; state Exp;
- branches;
- next 1.5;
-
- 1.5
- date 94.02.27.19.32.05; author peteric; state Exp;
- branches;
- next 1.4;
-
- 1.4
- date 94.02.13.16.44.05; author peteric; state Exp;
- branches;
- next 1.3;
-
- 1.3
- date 94.02.12.20.32.21; author peteric; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 94.02.12.20.00.18; author peteric; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 94.02.12.19.51.19; author peteric; state Exp;
- branches;
- next ;
-
-
- desc
- @Header file for ftree
- @
-
-
- 1.11
- log
- @Added member datewidth to marriage structure; see print.c.
- @
- text
- @/*************************************************************************
- *
- * $Name$
- *
- * $Author: peteric $
- *
- * $Date: 1994/04/27 11:37:54 $
- *
- * $Revision: 1.10 $
- *
- * Purpose: Header file for ftree family tree formatter.
- *
- * $Log: ftree.h,v $
- * Revision 1.10 1994/04/27 11:37:54 peteric
- * changed structure to introduce lower-level pointer 'pmheader_t
- * which can be used for the left/right links when marriages must
- * be accounted for. Bumped up version number, added new prototypes
- * and included better font support.
- *
- * Revision 1.9 1994/03/26 11:28:03 peteric
- * new function prototypes, new enum.
- *
- * Revision 1.8 1994/03/10 21:28:26 peteric
- * Multiple pages working!
- *
- * Revision 1.7 1994/03/07 12:46:37 peteric
- * Passed on as first Version.
- *
- * Revision 1.6 1994/03/01 23:17:53 peteric
- * added new function defs; upped the version number.
- *
- * Revision 1.5 94/02/27 19:32:05 19:32:05 peteric (Peter Ivimey-Cook)
- * extended structures; added new functionality. This one
- * now works!
- *
- * Revision 1.4 1994/02/13 16:44:05 peteric
- * added new variables to support the changes in print.c; added
- * marrlines var to hold the number of lines required for a marriage.
- * Deleted unused lineheight; added comments.
- *
- * Revision 1.3 1994/02/12 20:32:21 peteric
- * changed interface to marriages to allow multiple marriages per id
- *
- * Revision 1.2 94/02/12 20:00:18 20:00:18 peteric (Peter Ivimey-Cook)
- * added in comments etc.
- *
- *
- *
- *************************************************************************/
-
- /*
- * ftree.h header file.
- */
-
- #ifndef _FTREE_H
- #define _FTREE_H
-
- #include <stdio.h>
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #define TRUE 1
- #define FALSE 0
-
- #if defined(__hpux) || defined(__GNUC__)
- #define stricmp strcasecmp
- #elif defined(amiga)
- #define stricmp strcmp
- #endif
-
- #define MAXLEVELS 32
- #define NAMELEN 64
- #define OCCLEN 128
-
- #if defined(__unix)
- #define PROCSET_FILENAME "./ftinit.ps"
- #elif defined(amiga)
- #define PROCSET_FILENAME "s:ftree-init.ps"
- #endif
-
- /*
- * id code
- */
- typedef long id_t;
-
- #define NOID 0L
-
- enum living_t
- {
- L_LIVING,
- L_DEAD,
- L_UNKNOWN
- };
-
- enum mhint_t
- {
- H_CENTERED,
- H_LEFT,
- H_RIGHT
- };
-
- enum xpspec_t
- {
- XP_FIRST,
- XP_LAST
- };
-
- enum mstate_t
- {
- M_MARRIED,
- M_DIVORCED,
- M_SEPARATED,
- M_WIDOWED,
- M_UNKNOWN
- };
-
- enum sex_t
- {
- S_MALE,
- S_FEMALE,
- S_UNKNOWN
- };
-
- typedef struct
- {
- char *font; /* proper name of font */
- float size; /* size in points */
- int linespc; /* line spacing for font */
- } fontinfo_t;
-
- typedef struct options
- {
- int printoccupation; /* flag - print occupations too? */
- int printids; /* flag - print ID codes too? */
- id_t startperson; /* ID of start person */
- char *outputfile; /* name of output file, 'con' => stdout */
- int vspace; /* diff btw two generations in points */
- fontinfo_t titlefont; /* font used for title */
- float titlegreylevel; /* grey level (0..1, 1 is white) for title box */
- fontinfo_t identfont; /* font used to draw identification details */
- fontinfo_t personfont; /* font used to draw people's names */
- fontinfo_t symfont; /* font used to draw sumbols */
- fontinfo_t datefont; /* font used to draw sumbols */
- char *titlestr; /* title of drawing */
- int ticklen; /* length of tick drawn from child line to child */
- int tree_gap; /* minimum column between people */
- float afmconst; /* width constant if no AFM file */
- int maxlevel; /* maximum number of levels (generations) to print */
- int pagewidth; /* 'width' of page - x dimension */
- int pageheight; /* 'height' of page - y dimension */
- int rmargin, bmargin; /* bottom,right paper margins */
- int lmargin, tmargin; /* left, top paper margins */
- char *papertype; /* name of paper size - e.g. a4 */
- int landscape; /* flag - in landscape mode? */
- int marrlines; /* number of lines per marriage */
- int bblx, bbux; /* bounding box x */
- int bbly, bbuy; /* bounding box y */
- int multipage; /* true when code does multple showpages */
- } options_t;
-
- typedef struct papersize
- {
- char *str; /* paper type name (case sensitive) */
- int xsz; /* x size in points */
- int ysz; /* y size in points */
- } papersize_t;
-
- typedef struct date
- {
- unsigned int known:1; /* date known at all? */
- unsigned int dvalid:1; /* day known */
- unsigned int mvalid:1; /* month known */
- unsigned int yvalid:1; /* year known */
- short day; /* day of month */
- short month; /* month of year 1..12 */
- int year; /* year (0..99 => 1900..1999) */
- } date_t;
-
- enum htype_t
- {
- HT_PERSON, HT_MARRIAGE
- };
-
- /*
- * person/marriage HEADER structure. Not valid on it's own.
- */
- typedef struct pmheader
- {
- enum htype_t type;
- struct pmheader *left, *right; /* people left & right on line */
- int xpos, ypos;
- int width;
- int level;
- } pmheader_t;
-
- typedef struct person
- {
- pmheader_t h;
- struct person *nextperson; /* next person */
- struct marriage *parents; /* pointer to parent's marriage record */
- struct person *nextchild; /* next (younger, right) child of parents */
- struct person *lastchild; /* last (older, left) child of parents */
- char firstname[NAMELEN]; /* own name */
- char family[NAMELEN]; /* family name */
- char occupation[OCCLEN]; /* occupation */
- id_t id; /* assigned ID */
- enum living_t living; /* living/dead/unknown */
- enum sex_t sex; /* male/female/unknown */
- int married; /* true if married */
- struct marriage *firstmarriage; /* first marriage or NULL */
- struct marriage *lastmarriage; /* last marriage in list or NULL */
- int fullname; /* true if full name printed */
- date_t born; /* date person was born */
- date_t bapt; /* date person was baptised */
- date_t died; /* date person died */
- } person_t;
-
- typedef struct marriage
- {
- pmheader_t h;
- struct marriage *nextmarriage; /* next marriage in global list */
- struct marriage *next; /* next marriage in person list */
- struct marriage *prev; /* previous marriage in person list */
- person_t *husband; /* husband in marriage */
- person_t *wife; /* wife in marriage */
- struct marriage *backlink; /* marriage we printed to get here */
- person_t *firstchild; /* pointer to first child of marriage */
- person_t *lastchild; /* pointer to last child of marriage */
- date_t when; /* when married */
- enum mstate_t state; /* divorced etc. */
- enum mhint_t hint; /* should center when printing ? */
- char *chartref; /* secondary chart reference string */
- int children; /* number of children */
- int legal; /* if true marriage 'proper' */
- int datewidth; /* width of a date line */
- } marriage_t;
-
- typedef struct
- {
- pmheader_t *first, *last; /* people on this level (d-linked list) */
- } level_t;
-
- /********************************************************************************/
-
- #ifdef DEBUG
- #define dbprintf(stuff) _dprintf stuff
- #define dbprintf_note(stuff) _dprintf stuff ; printf stuff
- #else
- #define dbprintf(stuff)
- #define dbprintf_note(stuff)
- #endif
-
- #define VERSION "0.3"
- #define INCH 72
-
- #define XOF(opts, x) (x)
- #define YOF(opts, y) ((opts->pageheight-(opts->bmargin+opts->tmargin))-(y))
-
- #define DXOF(opts, x) (x)
- #define DYOF(opts, y) (-(y))
-
- #define streq(str1, str2) (strcmp(str1, str2) == 0)
-
- #define idcmp(id1, id2) (id1 == id2)
-
- /********************************************************************************/
-
- void usage();
- void parse(FILE *fp, char *filename);
- void yyerror(char *str);
- void print(options_t *opts);
- void makeperson(person_t *person);
- marriage_t *makemarriage(marriage_t *prev,id_t husb, id_t wife, date_t when, enum mstate_t state,
- enum mhint_t hint, person_t *first_child, person_t *last_child);
- marriage_t *findfirstmarriage(id_t id);
- marriage_t *findmarriage2(id_t hid, id_t wid);
- person_t *findperson(id_t id);
- void add_child(id_t id);
- void setpapertype(options_t *opts);
- void printperson(FILE *outf, options_t *opts, person_t *person, int x, int y);
- void printmarriage(FILE *outf, options_t *opts, marriage_t *marriage, int x, int y);
- void do_title(FILE *outf, options_t *opts, marriage_t *marriage);
- void do_prolog(FILE *outf, options_t *opts);
- void do_epilog(FILE *outf, options_t *opts);
- void do_simple_layout(options_t *opts, marriage_t *marriage, int x, int y, int level);
- void print_tree(FILE *outf, options_t *opts, marriage_t *marriage);
- char *date2string(struct date *d);
- int widthof(options_t *options, person_t *pers);
- int widthofmarriage(options_t *options, marriage_t *m);
- void move_tree(person_t *person, int dx);
- void clear_date(date_t *date);
- id_t makeid(person_t *p);
- id_t cvid(const char *str);
- void errmsg(const char *str, ...);
- void warnmsg(const char *str, ...);
- void usage(void);
- int xposof(pmheader_t *p, enum xpspec_t spec);
- int pwidthof(pmheader_t *p, enum xpspec_t spec);
- void datefmt(char *buf, struct date *b, struct date *d);
- void setmarriagewidths(options_t *opts, marriage_t *mroot);
- void setpersonwidths(options_t *opts, person_t *proot);
-
- int yyparse(void);
- int yylex(void);
- void yyrestart(FILE*);
-
- int loadfont(fontinfo_t *font);
- void unloadfont(fontinfo_t *font);
- double stringwidth(fontinfo_t *font, double afmconst, char *string);
-
- #ifndef EXTERN
- #define EXTERN extern
- #endif
-
- #ifdef DEBUG
- void _dprintf(char *str, ...);
- EXTERN int debug;
- #endif
-
- EXTERN int verbose; /* verbose mode */
- EXTERN person_t *proot; /* root of person list using nextperson */
- EXTERN marriage_t *mroot; /* root of marriage list using nextmarriage */
- EXTERN options_t *glob_opts; /* global pointer to options within parse() */
- EXTERN char *psfontpath;
- EXTERN level_t generation[MAXLEVELS]; /* level pointers */
- EXTERN int nlevels; /* # levels used */
-
- /* these defined in errs.c */
- extern int reading_file; /* true when reading input file */
- extern int errors; /* # errors so far */
- extern char *current_filename; /* current filename pointer */
- extern int lineno; /* current linenumber */
-
- #endif
- @
-
-
- 1.10
- log
- @changed structure to introduce lower-level pointer 'pmheader_t
- which can be used for the left/right links when marriages must
- be accounted for. Bumped up version number, added new prototypes
- and included better font support.
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/03/26 11:28:03 $
- d9 1
- a9 1
- * $Revision: 1.9 $
- d14 6
- d237 1
- @
-
-
- 1.9
- log
- @new function prototypes, new enum.
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/03/10 21:28:26 $
- d9 1
- a9 1
- * $Revision: 1.8 $
- d14 3
- d175 17
- d194 1
- a195 2
- struct person *mparent; /* linked to mother's person node if known */
- struct person *fparent; /* linked to father's person node if known */
- a198 1
- struct person *left, *right; /* people left & right on line */
- a204 1
- int level; /* level - generations from start */
- a208 1
- int width; /* value of widthof() */
- a211 1
- int xpos, ypos; /* location of top centre when printed */
- d216 1
- d223 2
- a227 2
- person_t *firstchild; /* pointer to first child of marriage */
- person_t *lastchild; /* pointer to last child of marriage */
- a229 1
- int level; /* level - generations from start */
- a230 2
- int xpos, ypos; /* location of centre when printed */
- int width; /* required size */
- d233 1
- a233 1
- typedef struct level
- d235 1
- a235 1
- person_t *first, *last; /* people on this level (d-linked list) */
- d241 2
- a242 1
- #define dbprintf(stuff) _dprintf stuff
- d245 1
- d248 1
- a248 1
- #define VERSION "0.2"
- a280 1
- void adjust_layout(FILE *outf, options_t *opts);
- d292 2
- a293 2
- int xposof(person_t *p, enum xpspec_t spec);
- int pwidthof(person_t *p, enum xpspec_t spec);
- d295 2
- d319 5
- a327 3
-
- EXTERN level_t generation[MAXLEVELS]; /* level pointers */
- EXTERN int nlevels; /* # levels used */
- @
-
-
- 1.8
- log
- @Multiple pages working!
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/03/07 12:46:37 $
- d9 1
- a9 1
- * $Revision: 1.7 $
- d14 3
- d71 1
- a71 1
- #define PROCSET_FILENAME "S:ftinit.ps"
- d95 6
- d190 1
- d203 1
- d217 1
- a217 1
- int width, height; /* required size */
- d255 1
- a255 1
- marriage_t *findmarriage1(id_t id);
- a256 1
- marriage_t *nextmarriage(marriage_t *m, id_t id);
- d262 1
- a262 1
- void do_title(FILE *outf, options_t *opts);
- d265 3
- a267 3
- void do_simple_layout(options_t *opts, id_t id, int x, int y, int level);
- void adjust_layout(FILE *outf, options_t *opts, id_t id);
- void print_tree(FILE *outf, options_t *opts, id_t marriage);
- d270 1
- d278 3
- a280 4
- person_t *findleftat(marriage_t *, int);
- person_t *findrightat(marriage_t *, int);
- int xposof(person_t *p);
- int yposof(person_t *p);
- d286 4
- d303 4
- a306 4
- EXTERN int reading_file; /* true when reading input file */
- EXTERN int errors; /* # errors so far */
- EXTERN char *current_filename; /* current filename pointer */
- EXTERN int lineno; /* current linenumber */
- @
-
-
- 1.7
- log
- @Passed on as first Version.
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/03/01 23:17:53 $
- d9 1
- a9 1
- * $Revision: 1.6 $
- d14 3
- d65 6
- d96 2
- a97 1
- M_SEPERATED,
- d130 2
- d142 1
- d201 1
- @
-
-
- 1.6
- log
- @added new function defs; upped the version number.
- @
- text
- @d7 1
- a7 1
- * $Date: 94/02/27 19:32:05 $
- d9 1
- a9 1
- * $Revision: 1.5 $
- d13 4
- a16 1
- * $Log: ftree.h,v $
- d228 1
- a228 1
- void makemarriage(marriage_t *prev,id_t husb, id_t wife, date_t when, enum mstate_t state,
- @
-
-
- 1.5
- log
- @extended structures; added new functionality. This one
- now works!
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/02/13 16:44:05 $
- d9 1
- a9 1
- * $Revision: 1.4 $
- d13 5
- a17 1
- * $Log: ftree.h,v $
- d205 1
- a205 1
- #define VERSION "0.1"
- d239 1
- a239 1
- void adjust_layout(options_t *opts, id_t id);
- d252 2
- @
-
-
- 1.4
- log
- @added new variables to support the changes in print.c; added
- marrlines var to hold the number of lines required for a marriage.
- Deleted unused lineheight; added comments.
- @
- text
- @d7 1
- a7 1
- * $Date: 1994/02/12 20:32:21 $
- d9 1
- a9 1
- * $Revision: 1.3 $
- d14 5
- d45 1
- a45 1
- #ifdef __hpux
- d47 1
- a47 3
- #endif
-
- #if defined(amiga) && !defined(__GNUC__)
- d51 11
- d69 7
- d93 3
- a95 3
- char *font;
- float size;
- int linespc;
- d100 23
- a122 21
- int printoccupation; /* flag - print occupations too? */
- int printids; /* flag - print ID codes too? */
- char *startperson; /* ID of start person */
- char *outputfile; /* name of output file, 'con' => stdout */
- int vspace; /* diff btw two generations in points */
- fontinfo_t title; /* font used for title */
- float titlegreylevel; /* grey level (0..1, 1 is white) for title box */
- fontinfo_t ident; /* font used to draw identification details */
- fontinfo_t person; /* font used to draw people's names */
- char *titlestr; /* title of drawing */
- int ticklen; /* length of tick drawn from child line to child */
- int maxlevel; /* maximum number of levels (generations) to print */
- int pagewidth; /* 'width' of page - x dimension */
- int pageheight; /* 'height' of page - y dimension */
- int rmargin, bmargin; /* bottom,right paper margins */
- int lmargin, tmargin; /* left, top paper margins */
- char *papertype; /* name of paper size - e.g. a4 */
- int landscape; /* flag - in landscape mode? */
- int marrlines; /* number of lines per marriage */
- int bblx, bbux; /* bounding box x */
- int bbly, bbuy; /* bounding box y */
- d127 3
- a129 3
- char *str;
- int xsz; /* x size in points */
- int ysz; /* y size in points */
- d134 7
- a140 7
- unsigned int known:1;
- unsigned int dvalid:1;
- unsigned int mvalid:1;
- unsigned int yvalid:1;
- short day;
- short month;
- int year;
- a142 7
- typedef struct level
- {
- struct level *up, *down;
- int level;
-
- } level_t;
-
- d146 16
- a161 10
- struct person *mparent; /* links toparents */
- struct person *fparent; /* links toparents */
- struct person *nextchild; /* next child of parents */
- char firstname[64];
- char family[64];
- char id[96];
- enum living_t living;
- enum sex_t sex;
- int married;
- int fullname;
- d163 4
- a166 5
- date_t born;
- date_t bapt;
- date_t died;
- int xpos, ypos; /* location of centre when printed */
- char occupation[128];
- d171 2
- a172 1
- struct marriage *next; /* next marriage */
- d174 9
- a182 7
- person_t *wife; /* wife in marriage */
- date_t when; /* when married */
- enum mstate_t state;
- person_t *firstchild; /* pointer to first child in list */
- person_t *lastchild; /* pointer to last child in list */
- int children;
- int level;
- d184 2
- a185 2
- int xpos, ypos; /* location of centre when printed */
- int width, height; /* required size */
- d188 5
- d201 1
- a201 1
- #define VERSION "1.0"
- d205 1
- a205 1
- #define YOF(opts, y) ((opts->pageheight - (opts->bmargin+opts->tmargin)) - (y))
- d212 2
- d221 7
- a227 6
- void makemarriage(char *husb, char *wife, date_t when, enum mstate_t state,
- person_t *first_child, person_t *last_child);
- marriage_t *findmarriage(char*id);
- marriage_t *nextmarriage(marriage_t *m, char *id);
- person_t *findperson(char*id);
- void add_child(char *str);
- d234 3
- a236 3
- void do_simple_layout(options_t *opts, char *id, int x, int y, int level);
- void adjust_layout(options_t *opts, char *id);
- void print_tree(FILE *outf, options_t *opts, char *marriage);
- d239 1
- a239 1
- void move_tree(marriage_t *marriage, int dx);
- d241 7
- d249 4
- d262 8
- a269 4
- EXTERN int verbose;
- EXTERN person_t *proot;
- EXTERN marriage_t *mroot;
- EXTERN options_t *glob_opts;
- d271 2
- a272 2
- extern char *current_filename;
- extern int lineno;
- @
-
-
- 1.3
- log
- @changed interface to marriages to allow multiple marriages per id
- @
- text
- @d7 1
- a7 1
- * $Date: 94/02/12 20:00:18 $
- d9 1
- a9 1
- * $Revision: 1.2 $
- d13 4
- a16 1
- * $Log: ftree.h,v $
- d79 19
- a97 17
- int printoccupation;
- int printids;
- char *startperson;
- char *outputfile;
- int vspace; /* diff btw two generations in points */
- int lineheight;
- fontinfo_t title;
- fontinfo_t ident;
- fontinfo_t person;
- char *titlestr;
- int maxlevel;
- int pagewidth;
- int pageheight;
- int rmargin, bmargin;
- int lmargin, tmargin;
- char *papertype;
- int landscape;
- a99 1
- int ticklen;
- d172 1
- @
-
-
- 1.2
- log
- @added in comments etc.
- @
- text
- @d5 1
- a5 1
- * $Author$
- d7 1
- a7 1
- * $Date$
- d9 1
- a9 1
- * $Revision$
- d13 4
- a16 1
- * $Log$
- d188 1
- d197 3
- a199 3
- void do_simple_layout(options_t *opts, marriage_t *marriage, int x, int y, int level);
- void adjust_layout(options_t *opts, marriage_t *marriage);
- void print_tree(FILE *outf, options_t *opts, marriage_t *marriage);
- a202 1
- void adjust_layout(options_t *opts, marriage_t *marriage);
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d1 17
- @
-